package com.wpml.ware.api;

import com.wpml.common.util.RUtil;
import com.wpml.ware.vo.SkuHasStockVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(name = "ware-service", fallback = WareFeignClient.WareFeignClientFallback.class)
public interface WareFeignClient {

    @PostMapping("/ware/waresku/hasStock")
    RUtil<List<SkuHasStockVo>> hasStock(@RequestBody List<Long> skuIds);

    abstract class WareFeignClientFallback<T> implements WareFeignClient {

        public RUtil<T> defaultFallback() {

            return new RUtil<T>().fail("微服务调用异常，请联系管理员");
        }
    }
}
